package com.skaz.service;

import com.skaz.bean.Page;
import com.skaz.bean.Result;
import com.skaz.dao.DemoDao;
import com.skaz.entity.Demo;
import com.skaz.util.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: jungle
 * @Date: 2018/11/2 5:44 PM
 */
@Service
public class DemoService {
    @Autowired
    private DemoDao demoDao;

    public Demo get(Long id) {
        return demoDao.get(id);
    }

    public List<Demo> list() {
        return demoDao.list();
    }

    public Page<Demo> page(int pageNo, int pageSize) {
        return demoDao.page(null,pageNo,pageSize);
    }

    public Result create(String name) {
        Demo demo = new Demo();
        demo.setName(name);
        demoDao.create(demo);
        return Results.success();
    }
}
